package tech.aistar.service.order;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Service;
import tech.aistar.entity.ServiceOrder;
import tech.aistar.vo.ServiceOrderVo;

import java.util.List;

/**
 * Created by 23827 on 2019/9/28.
 */
@Service
public interface IServiceOrderService {
    //    查询所有的

    @Select("select * from service_order")
    List<ServiceOrder> findAll();

//    通过服务订单的订单编号和名称进行查找

    List<ServiceOrder> find(@Param("order_number") String order_number);

//    删除

    @Update("update service_order set status = 0 where id = #{value}")
    ServiceOrder delById(Integer id);

//    添加

    ServiceOrder insertServiceOrder(ServiceOrder serviceOrder);

    //    更新
    ServiceOrder updateServiceOrder(ServiceOrder serviceOrder);

    //    通过id进行查询
    @Select("select * from service_order where id = #{value}")
    List<ServiceOrder> getById(Integer id);

    //通过id查一个对象
    @Select("select * from service_order where id = #{id}")
    ServiceOrder findByIdOne(Integer id);

    //服务订单表的第三方实体类
    List<ServiceOrderVo> serviceOrderVo(Integer userinfo_id);

    @Select("select id from service_order where order_number = #{order_number} ")
    Integer findByOrderNumber(String order_number);

    //通过id查出订单编号
    @Select("select order_number from service_order where id = #{value}")
    String selectById(Integer id);

    //修改部分

    void updateOne(ServiceOrder serviceOrder);
}
